// import { EnterpriseListParams,EnterpriseListData } from "@/types/enterprise"
import type { Datum, EnterpriseListData, EnterpriseListParams, EnterpriseParams, Industry, RentBuilding, RentParams } from "@/types/enterprise"
import { request } from "@/utils/reuqest"

/**
 * 获取企业列表
 * @param { page, pageSize} params
 * @returns
 */
export const getEnterpriseListAPI = (params:EnterpriseListParams)=>{
  return request<EnterpriseListData>('/park/enterprise','GET',params)
} 

/**
 * 获取行业列表
 * @returns
 */
export const getIndustryListAPI = ()=>{
  return request<Industry[]>('/park/industry','GET')
} 


/**
 * 添加企业
 * @param {*} data
 * @returns
 */
export const createEnterpriseAPI = (data: EnterpriseParams) =>{
  return request('/park/enterprise', 'POST', data)
}

/**
 * 获取空置中楼宇列表（未租赁）
 * @param {*}
 * @returns
 */
export const getRentBuildListAPI = () =>{
  return request<RentBuilding[]>('/park/rent/building','GET')
}

/**
 * 给当前企业添加合同
 * @param {*} data
 * @returns
 */
export const  createRentAPI = (data: RentParams) => {
  return request('/park/enterprise/rent', 'POST', data)
}


/**
 * 获取企业下合同列表
 * @param {*} id
 * @returns
 */
export const getRentListAPI = (id: number) => {
  return request<Datum[]>(`/park/enterprise/rent/${id}`)
}

/**
 * 退租合同
 * @param {合同id} rentId
 * @returns
 */
export const outRentAPI = (rentId: string)=> {
  return request(`/park/enterprise/rent/${rentId}`, 'PUT')
}

/**
 * 删除合同
 * @param {合同id} rentId
 * @returns
 */
export const deleteRentAPI = (rentId: string)=> {
  return request(`/park/enterprise/rent/${rentId}`, 'DELETE')
}